import request from '@/config/axios'

export interface NetAccountVO {
	id: number
	commId: number
	netSysId: number
	lfPackId: number
	packType: number
	packName: string
	serviceProvider: number
	price: number
	duration: number
	speed: number
	sort: number
	remark: string
	buyTimes: number
	packStatus: number
	houseId: number
	bindPackId: string
}

export interface NetAccountCreateVO {
	netAccount: string // 宽带账号
	netPackageId: number // 套餐id
	relaId: number // 租住关系id
	memberUserId: number // 用户id
	houseId: number // 房产id
	roomId: number // 房间id
}

// 获得宽带账号分页
export const getPage = async (params: object) => {
	return await request.get({ url: `/zwsj/net-account/page`, params })
}

// 获得宽带账号
export const getPackage = async (id: number) => {
	return await request.get({ url: `/zwsj/net-account/get?id=` + id })
}

// 更新宽带账号
export const updatePackage = async (data: object) => {
	return await request.put({ url: `/zwsj/net-account/update`, data })
}

// 创建宽带账号
export const createRent = async (data: object) => {
	return await request.post({ url: `/zwsj/net-account/create/rent`, data })
}

// 创建宽带账号
export const createUser = async (data: object) => {
	return await request.post({ url: `/zwsj/net-account/create/user`, data })
}

// 删除宽带账号
export const deleteNetAccount = async (id: number) => {
	return await request.delete({ url: `/zwsj/net-account/delete?id=` + id })
}

/**
 * 获得子宽带账号分页
 */
export const getNetAccountChildPage = async (parentId: number) => {
	return await request.get({ url: `/zwsj/net-account-child/page?parentId=` + parentId })
}
